/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package qs.crm.modules.product.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;

/**
* @website https://eladmin.vip
* @description /
* @author tong
* @date 2023-05-27
**/
@Entity
@Data
@Table(name="product")
public class Product implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`prod_id`")
    @ApiModelProperty(value = "产品编号")
    private Long prodId;

    @Column(name = "`prod_name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "产品名称")
    private String prodName;

    @Column(name = "`prod_type`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "产品类型")
    private String prodType;

    @Column(name = "`prod_batch`")
    @ApiModelProperty(value = "产品批次号")
    private String prodBatch;

    @Column(name = "`prod_unit`")
    @ApiModelProperty(value = "单位")
    private String prodUnit;

    @Column(name = "`prod_price`")
    @ApiModelProperty(value = "单价")
    private BigDecimal prodPrice;

    @Column(name = "`prod_memo`")
    @ApiModelProperty(value = "产品备注")
    private String prodMemo;

    public void copy(Product source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
